package orest.back.membermanage;

import java.sql.Connection;
import java.sql.SQLException;

import org.apache.log4j.Logger;

import net.ssta.common.Constants;
import net.ssta.core.db.DBConnectionProvider;
import net.ssta.core.db.DataBaseExecutor;
import net.ssta.core.db.PagingInfo;
import net.ssta.core.db.Record;
import net.ssta.core.db.RecordSet;

public class UnitSearchHandler {
	private static Logger log = Logger.getLogger(UnitSearchHandler.class.getClass()); 
	
	/**
	 *  
	 * @return
	 * @throws SQLException
	 */
	public RecordSet unitList(Record searchData,PagingInfo pageingInfo) throws SQLException {
		RecordSet rs=null;
		Connection conn = null;
    	try {
    		
    		conn = DBConnectionProvider.getConnection(Constants.JNDI_SSTA);
	    	DataBaseExecutor dbe = DataBaseExecutor.getExecutor(conn);
	        String sql=UserManagerSql.unitList(searchData);
	    	rs=dbe.find(sql,pageingInfo);
	    	
		} catch (SQLException e) {
			log.error("展现用户升级申请列表出错："+e);
			throw e;
		}finally{
			try{
				if(conn != null) conn.close();
			}catch (SQLException e){
				 log.error("关闭conn出错",e);
			}
		}
    	return rs;
	}
	
	
	/**
	 *  
	 * @return
	 * @throws SQLException
	 */
	public RecordSet expertList(Record searchData,PagingInfo pageingInfo) throws SQLException {
		RecordSet rs=null;
		Connection conn = null;
    	try {
    		
    		conn = DBConnectionProvider.getConnection(Constants.JNDI_SSTA);
	    	DataBaseExecutor dbe = DataBaseExecutor.getExecutor(conn);
	        String sql=UserManagerSql.expertList(searchData);
	    	rs=dbe.find(sql,pageingInfo);
	    	
		} catch (SQLException e) {
			log.error("展现用户升级申请列表出错："+e);
			throw e;
		}finally{
			try{
				if(conn != null) conn.close();
			}catch (SQLException e){
				 log.error("关闭conn出错",e);
			}
		}
    	return rs;
	}

}
